/*
 *  Copyright (C) 2010 Glauco
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.balisunrise.common.abstracts;

import java.lang.reflect.Method;
import org.balisunrise.common.Event;

/**
 *
 * @author Glauco
 */
public abstract class AbstractAction extends AbstractBasic{

    public static final String PROP_METHOD = "method";
    public static final String PROP_WITH_PARM = "withParm";
    public static final String PROP_ACTION_MAP_CLASS = "actionMapClass";
    public static final String PROP_PROPERTIES = "properties";

    protected Method method;

    protected boolean withParm;

    protected Class actionMapClass;

    protected String[] properties;

    public abstract void perform(Event evt);

    // <editor-fold defaultstate="collapsed" desc="Get's & Set's">

    public Method getMethod() {
        return method;
    }

    public void setMethod(Method method) {
        Method oldMethod = this.method;
        this.method = method;
        changeSupport.firePropertyChange(PROP_METHOD, oldMethod, method);
    }

    public Class getActionMapClass() {
        return actionMapClass;
    }

    public void setActionMapClass(Class actionMapClass) {
        Class old = this.actionMapClass;
        this.actionMapClass = actionMapClass;
        changeSupport.firePropertyChange(
                PROP_ACTION_MAP_CLASS,old,actionMapClass);
    }

    public String[] getProperties() {
        return properties;
    }

    public void setProperties(String[] properties) {
        String[] old = this.properties;
        this.properties = properties;
        changeSupport.firePropertyChange(PROP_PROPERTIES, old, properties);
    }

    public boolean isWithParm() {
        return withParm;
    }

    public void setWithParm(boolean withParm) {
        boolean old = this.withParm;
        this.withParm = withParm;
        changeSupport.firePropertyChange(PROP_WITH_PARM, old, withParm);
    }
    // </editor-fold>
}
